package com.ssl.rms.controller.system;

import com.github.pagehelper.PageInfo;
import com.ssl.rms.controller.BaseController;
import com.ssl.rms.entity.UserExample;
import com.ssl.rms.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * 描述：用户管理
 *
 * @author ssl
 * @create 2018/05/28 14:31
 */
@Controller
@RequestMapping("sys/user")
public class UserController extends BaseController {

    @Autowired
    private UserService userService;


    @RequestMapping(value = {"", "/", "index"})
    public String index() {
        return "system/user/index";
    }
    @RequestMapping(value = {"list"})
    @ResponseBody
    public Map<String,Object> list(Integer page, Integer rows) {
        if (null == page || page < 1) {
            page = 1;
        }
        if (null == rows || rows < 1) {
            rows = 10;
        }
        PageInfo pageInfo = userService.findPageInfo(page, rows, new UserExample());
        return SUCCESS(pageInfo);
    }
}
